package com.example.basics.examples;


import com.example.basics.model.Student;

public class PassByReferenceExample {


    private static void func(Student student) {
        System.out.println(student); //Student@568db2f2
        student = new Student("B","123","admin");
        System.out.println(student); //Student@378bf509
        System.out.println(student.getUsername());          // B
    }

    public static void main(String[] args) {
        Student student = new Student("A","123","dba");
        System.out.println(student); //Student@568db2f2
        func(student);
        System.out.println(student); //Student@568db2f2
        System.out.println(student.getUsername());          // A
    }
}

